package com.nxcy.caculator.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class CalTime {
    @Around(value = "execution(* com.nxcy.caculator.oper.*.*(..))")
    public Object around(ProceedingJoinPoint point) throws Throwable {

        Long start = System.currentTimeMillis();
        Object obj = point.proceed();
        long end = System.currentTimeMillis();
        System.out.println("执行完毕,花费时间为:" + (end - start) + "ms");
        return obj;
    }
}
